package com.shuoyue.ycgk.views.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import androidx.annotation.NonNull;

import com.shuoyue.ycgk.R;

import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * 带确认取消按钮的Dialog
 * Created by Forty'7 on 2019/6/17.
 */

public class PaintControllDialog extends Dialog {


    ControllerCallback callBack;

    public PaintControllDialog(@NonNull Context context,@NonNull ControllerCallback callBack) {
        super(context, R.style.dialog);
        this.callBack = callBack;
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setWindowAnimations(R.style.ChooseStyle);
        View view = View.inflate(context, R.layout.dialog_paint_controll, null);
        setContentView(view);
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        getWindow().setGravity(Gravity.TOP);

        ButterKnife.bind(this, view);
//        getWindow().setLayout((SizeUtil.getScreenWidth(mContext) * 3) / 4, ViewGroup.LayoutParams.WRAP_CONTENT);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
    }

    @OnClick({R.id.close, R.id.last, R.id.clear, R.id.next})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.close:
                callBack.close();
                break;
            case R.id.last:
                callBack.last();
                break;
            case R.id.clear:
                callBack.clear();
                break;
            case R.id.next:
                callBack.next();
                break;
        }
    }


    public interface ControllerCallback {
        void close();

        void clear();

        void last();

        void next();
    }
}
